<?php
/*
 * 招商显示页面
 * @author     Mark <zhaody901@126.com>
 * @copyright  Copyright (c) 2013 lemon team
 * @version    $Id: a20f34b3a0e38ed2f70a12b70d284cbdd5c4c3b8 $
 * @time       13-12-27 上午9:28
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
$itemid or dheader($MOD['linkurl']);
$item = $db->getOne("SELECT * FROM {$table} WHERE itemid=$itemid");
//适用车品牌
$arbid=$item['arbid'];
if ($arbid) {
	$autoBrand = AutoBrand::get($arbid);
}
$arcid = $item['arcid'];
if ($arcid) {
	$autoCar = AutoCar::get($arcid);
}

//同类信息
$catid=$item['catid'];
$semesell=array();
$typesell = $db->getAll("SELECT * FROM {$table} WHERE catid=$catid");
foreach($typesell as $v=>$sll){
        $semesell[$v]['itemid']=$sll['itemid'];
        $semesell[$v]['title']=$sll['title'];
        $semesell[$v]['thumb']=$sll['thumb'];
        $semesell[$v]['linkurl']=$sll['linkurl'];
}

if($item && $item['status'] >= 2) {

	extract($item);
} else {
	$head_title = lang('message->item_not_exists');
	@header("HTTP/1.1 404 Not Found");
	exit(include template('show-notfound', 'message'));
}
$CAT = get_cat($catid);
if(!check_group($_groupid, $MOD['group_show']) || !check_group($_groupid, $CAT['group_show'])) {
	$head_title = lang('message->without_permission');
	exit(include template('noright', 'message'));
}
$content_table = content_table($moduleid, $itemid, $MOD['split'], $table_data);
$t = $db->getOne("SELECT content FROM {$content_table} WHERE itemid=$itemid");
$content = $t['content'];
if($MOD['keylink']) $content = keylink($content, $moduleid);
$adddate = timetodate($addtime, 3);
$editdate = timetodate($edittime, 3);
$todate = $totime ? timetodate($totime, 3) : 0;
$expired = $totime && $totime < $DT_TIME ? true : false;
$linkurl = linkurl($linkurl, 1);
$thumbs = get_albums($item);
$albums =  get_albums($item, 1);
$amount = number_format($amount, 0, '.', '');
$fee = get_fee($item['fee'], $MOD['fee_view']);
$update = '';
if(check_group($_groupid, $MOD['group_contact'])) {
	if($fee) {
		$user_status = 4;
	} else {
		$user_status = 3;
		$member = $item['username'] ? userinfo($item['username']) : array();
		if($item['totime'] && $item['totime'] < $DT_TIME && $item['status'] == 3) {
			$update .= ",status=4";
			$db->query("UPDATE {$table}_search SET status=4 WHERE itemid=$itemid");
		}
	
	}
} else {
	$user_status = $_userid ? 1 : 0;
	if($_username && $item['username'] == $_username) {
		$user_status = 3;
	}
}


include DT_INC.'/update.inc.php';
$seo_file = 'show';
include DT_INC.'/seo.inc.php';
//$template = $item['template'] ? $item['template'] : ($CAT['show_template'] ? $CAT['show_template'] : 'show');
$template='show';
include template($template, $module);